package com.octopus.optiworks.dao;

import java.util.List;

import org.springframework.stereotype.Component;
import com.octopus.optiworks.model.Employee;

@Component
public class UserDao extends GenericHibernateDao<Employee, Long>{
	
    public Employee findUser(String username) {
    	Employee user = new Employee();
    	user.setUsername(username);
    	List<Employee> list = super.findByExcemple(user);
    	if(list == null)
    		return null;
        return list.get(0);
    }
    
	public List<Employee> loadAll(){
		List<Employee> list = super.find("from Employee u order by u.username", new String[]{});
		return list;
	}

}
